package com.chinairi.mall.service.impl;

import com.chinairi.mall.constant.CiccTableNameEnum;
import com.chinairi.mall.dao.CiccTableMapper;
import com.chinairi.mall.model.CiccRecord;
import com.chinairi.mall.service.CiccTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

/**
 * @author 李昌赐
 * @since 2020−11-24
 */
@Service
public class CiccTableServiceImpl implements CiccTableService {

    @Autowired
    private CiccTableMapper ciccTableMapper;

    private  List<CiccRecord> listCiccRecord(String ciccTableName, boolean addNull ){
       List<CiccRecord> listCiccRecord =  ciccTableMapper.listCiccRecord(ciccTableName,null,null);
        if (addNull) {
            listCiccRecord.add(0, (new CiccRecord()).init());
        }
        return listCiccRecord;
    }

    @Override
    public List<CiccRecord> listProductType(){
        return listCiccRecord(CiccTableNameEnum.PRODUCT_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listConfirmStatus(){
        return listCiccRecord(CiccTableNameEnum.ORDER_CONFIRM_STATUS.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listPurchaseClassify(){
        return listCiccRecord(CiccTableNameEnum.PURCHASE_CLASSIFY.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listEnterpriseChracter(){
        return listCiccRecord(CiccTableNameEnum.ENTERPRISE_CHARACTER.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listContractType(){
        return listCiccRecord(CiccTableNameEnum.CONTRACT_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listYesNo(){
        return listCiccRecord(CiccTableNameEnum.YES_NO.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listPurchaseType(){
        return listCiccRecord(CiccTableNameEnum.PURCHASE_MODE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listUseStatus(){
        return listCiccRecord(CiccTableNameEnum.USE_STATUS.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listPayType(){
        return listCiccRecord(CiccTableNameEnum.PAY_TYPE.getCodeValue(),false);
    }

    @Override
    public List<Map<String,Object>> listServiceType(){
        return ciccTableMapper.listServiceType();
    }

    @Override
    public List<CiccRecord> listApproveSatus(){
        return listCiccRecord(CiccTableNameEnum.APPROVE_STATUS.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listProjectType(){
        return listCiccRecord(CiccTableNameEnum.PROJECT_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listGoodsStatus(){
        return listCiccRecord(CiccTableNameEnum.GOODS_STATUS.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listSettleType() {
        return listCiccRecord(CiccTableNameEnum.SETTLE_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listTransportType() {
        return listCiccRecord(CiccTableNameEnum.TRANSPORT_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listPickingType() {
        return listCiccRecord(CiccTableNameEnum.PICKING_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listQulificationType() {
        return listCiccRecord(CiccTableNameEnum.QUALIFICATION_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listUserType() {
        return listCiccRecord(CiccTableNameEnum.USER_TYPE.getCodeValue(),false);
    }

    @Override
    public List<CiccRecord> listQualityControl() {
        return listCiccRecord(CiccTableNameEnum.QUALITY_CONTROL.getCodeValue(),false);
    }
}
